<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
    <title>学生信息管理系统</title>
    <link href="/resources/bootstrap-3.3.5-dist/css/bootstrap.min.css" title="" rel="stylesheet"/>
    <link title="" href="/resources/css/style.css" rel="stylesheet" type="text/css"/>
    <link title="#990000" href="/resources/css/dermadefault.css" rel="stylesheet" type="text/css"/>
    <link href="/resources/css/templatecss.css" rel="stylesheet" title="" type="text/css"/>
    <script src="/resources/script/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script src="/resources/script/jquery.cookie.js" type="text/javascript"></script>
    <script src="/resources/bootstrap-3.3.5-dist/js/bootstrap.min.js" type="text/javascript"></script>
</head>

<body>
<%@ include file="head.jsp" %>
<div class="down-main">
    <%@ include file="left.jsp" %>
    <div class="right-product my-index right-full">
        <div class="container-fluid">
            <div class="info-center">
                <!---title----->
                <div class="info-title">
                    <div class="pull-left">
                        <p style="font-family: STXingkai;font-size: 40px; color: #bf0000;"><sub>欢迎您登录</sub>学生信息管理系统
                        </p>
                    </div>
                    <div class="time-title pull-right">
                        <div class="year-month pull-left">

                            <script type="text/javascript">
                                //动态显示时间
                                setInterval(
                                    "document.getElementById('year1').innerHTML=new Date().toLocaleDateString();", 1000);
                                setInterval(
                                    "document.getElementById('time1').innerHTML=' 星期'+'日一二三四五六'.charAt(new Date().getDay());", 1000);
                                setInterval(
                                    "document.getElementById('time2').innerHTML=new Date().toLocaleTimeString();", 1000);
                            </script>
                            <p id="time1"></p>
                            <p><span id="year1"></span></p>
                        </div>
                        <div class="hour-minute pull-right">
                            <strong id="time2"></strong>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
                <!----content-list---->
                <div class="content-list">
                    <div class="row">
                        <div class="col-md-5">
                            <div class="content">
                                <div class="w30 left-icon pull-left">
                                    <span class="glyphicon glyphicon-user blue"></span>
                                </div>
                                <div class="w70 right-title pull-right">
                                    <div class="title-content">
                                        <p style="font-family: STXingkai;font-size: 28px; color: #bf0000;">当前用户</p>
                                        <h3 class="text-center"><shiro:principal property="userName"/></h3>
                                    </div>
                                </div>
                                <div class="clearfix"></div>
                            </div>
                        </div>
                        <div class="col-md-5 col-md-offset-1">
                            <div class="content">
                                <div class="w30 left-icon pull-left">
                                    <span class="glyphicon  glyphicon-eye-open violet"></span>
                                </div>
                                <div class="w70 right-title pull-right">
                                    <div class="title-content">
                                        <p style="font-family: STXingkai;font-size: 28px; color: #bf0000;">您的角色</p>
                                        <shiro:hasRole name="teacher"><h3 class="text-center">教师 </h3></shiro:hasRole>
                                        <shiro:hasRole name="student"><h3 class="text-center">学生 </h3></shiro:hasRole>
                                    </div>
                                </div>
                                <div class="clearfix"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>
</div>
</div>
<script type="text/javascript">
    $(function () {
        /*左侧导航栏显示隐藏功能*/
        $(".subNav").click(function () {
            /*显示*/
            if ($(this).find("span:first-child").attr('class') == "title-icon glyphicon glyphicon-chevron-down") {
                $(this).find("span:first-child").removeClass("glyphicon-chevron-down");
                $(this).find("span:first-child").addClass("glyphicon-chevron-up");
                $(this).removeClass("sublist-down");
                $(this).addClass("sublist-up");
            }
            /*隐藏*/
            else {
                $(this).find("span:first-child").removeClass("glyphicon-chevron-up");
                $(this).find("span:first-child").addClass("glyphicon-chevron-down");
                $(this).removeClass("sublist-up");
                $(this).addClass("sublist-down");
            }
            // 修改数字控制速度， slideUp(500)控制卷起速度
            $(this).next(".navContent").slideToggle(300).siblings(".navContent").slideUp(300);
        })
        /*左侧导航栏缩进功能*/
        $(".left-main .sidebar-fold").click(function () {

            if ($(this).parent().attr('class') == "left-main left-full") {
                $(this).parent().removeClass("left-full");
                $(this).parent().addClass("left-off");

                $(this).parent().parent().find(".right-product").removeClass("right-full");
                $(this).parent().parent().find(".right-product").addClass("right-off");

            } else {
                $(this).parent().removeClass("left-off");
                $(this).parent().addClass("left-full");

                $(this).parent().parent().find(".right-product").removeClass("right-off");
                $(this).parent().parent().find(".right-product").addClass("right-full");

            }
        })

        /*左侧鼠标移入提示功能*/
        $(".sBox ul li").mouseenter(function () {
            if ($(this).find("span:last-child").css("display") == "none") {
                $(this).find("div").show();
            }
        }).mouseleave(function () {
            $(this).find("div").hide();
        })
    });

    //数据库备份
    function databasebackup() {
        if (confirm("请确认操作")) {
            $.ajax({
                url: '/databasebackup',
                type: 'post',
                dataType: 'json',
                success: function (data) {
                    if (data.errno == 0) {
                        alert(data.message);
                        location.reload()
                    } else {
                        alert(data.message);
                    }
                }
            });
        } else {
            location.reload()
        }
    }
</script>
</body>
</html>
